package com.lagou.boot;

import com.lagou.client.RPCConsumer;
import com.lagou.entity.RpcResponse;
import com.lagou.service.IUserService;

public class ConsumerBoot {

    public static void main(String[] args) throws InterruptedException {

        String methodName = "sayHello";
        //1.创建代理对象
        IUserService service = (IUserService) RPCConsumer.createProxy(IUserService.class, methodName);

        //2.循环给服务器写数据
        while (true){
            RpcResponse result = service.sayHello("你好，张三！");
            System.out.println("客服端响应：" + result.getId() + ":" + result.getStatus());
            System.out.println("客户端结果：" + result.getResultMsg());

            Thread.sleep(2000);
        }

    }
}
